<template>
    <div class="table">
        <div class="divSearch">
            <!--搜索框-->
            <Row>
                <!--根据需求删除不不要查询条件-->
                <Col :lg="{span:1}" :md="{span:3}" :sm="{span:4}" :xs="{span:4}" class="searchLabel">
                    <label>填报年度:</label>
                </Col>
                <Col :lg="{span:3}" :md="{span:4}" :sm="{span:8}" :xs="{span:20}">
                    <Select v-model="searchModel.FillInYear" placeholder="全部" style="width: 150px" @on-change="getPageData()" class="searchInput">               
                        <Option value="">全部</Option>            
                        <Option :value="item.DictValue" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
                    </Select>
                </Col>
                <Col :lg="{span:1}" :md="{span:3}" :sm="{span:4}" :xs="{span:4}" class="searchLabel">
                    <label>时间周期:</label>
                </Col>
                <Col :lg="{span:3}" :md="{span:4}" :sm="{span:8}" :xs="{span:20}">
                    <Select v-model="searchModel.TimesType" placeholder="全部" style="width: 150px" @on-change="getPageData()" class="searchInput">   
                            <Option value="">全部</Option>
                            <Option :value="item.DictValue" v-for="item in CycleList" :key="item.DictValue">{{item.DictText}}</Option>   
                        </Select>
                </Col>
                <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}">
                    <Button icon="ios-search" type="primary" @click="getPageData()" class="searchButton">查询</Button>
                </Col>
            </Row>
        </div>
        <Row>
            <Col>
                <Table :context="self" ref="table" :stripe=true :border=true :columns="TableHeader" :data="datas.rows" size="large" :height="clientHeight">
                </Table>
            </Col>
        </Row>
        <Row>
            <Col span="24">
            <Page class="pageComponent"  :total="datas.total" placement="top" @on-change="getPageNumber" :page-size="searchModel.PageSize" :page-size-opts='pageSizeOpts' show-sizer @on-page-size-change="getPageSize" show-total show-elevator></Page>
            </Col>
        </Row>
        <Modal v-model="showType" :mask-closable="false" width="1200">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">蔬菜技术推广机构及人员填报表</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
            <Tabs type="card">
                <Tab-pane label="蔬菜技术服务机构">
                    <table class="reportTable">
                        <thead>
                            <tr>
                                <td rowspan="2">总数(个)</td>
                                <td colspan="3">其中</td>
                            </tr>
                            <tr>
                                <td>州(市)级(个)</td>
                                <td>县(市)级(个)</td>
                                <td>乡镇级(个)</td> 
                            </tr>
                        </thead>
                        <tr>
                            <td><Input v-model="dataModel.InstituNum"></Input></td>
                            <td><Input v-model="dataModel.InstituNum_City"></Input></td>
                            <td><Input v-model="dataModel.InstituNum_Area"></Input></td>
                            <td><Input v-model="dataModel.InstituNum_town"></Input></td>
                        </tr>
                    </table>
                </Tab-pane>
                <Tab-pane label="蔬菜专业技术人员">
                    <table class="reportTable">
                        <thead>
                            <tr>
                                <td rowspan="2">总数</td>
                                <td colspan="2">地区</td>
                                <td colspan="2">性别</td>
                                <td colspan="4">年龄段</td>
                                <td colspan="5">学历</td>
                                <td colspan="5">职称等级</td>
                            </tr>
                            <tr>
                                <td>州市级人数</td>
                                <td>县乡级人数</td>
                                <td>男</td>
                                <td>女</td>                        
                                <td>30岁以下(含30)</td>
                                <td>30-40岁(含40)</td>
                                <td>40-50岁(含50)</td>
                                <td>50岁以上</td>
                                <td>硕士及以上</td>
                                <td>本科</td>
                                <td>大专</td>
                                <td>中专(技校)</td>
                                <td>其他</td>
                                <td>正高级</td>
                                <td>副高级</td>
                                <td>中级</td>
                                <td>初级</td>
                                <td>其他</td>
                            </tr>
                        </thead>
                        <tr>
                            <td><Input v-model="dataModel.PeopleNum"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_City"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_Area"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_man"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_woman"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_age1"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_age2"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_age3"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_age4"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_xlss"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_xlbk"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_xldz"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_xlzz"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_xlqt"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_zczgj"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_zcfgj"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_zczj"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_zccj"></Input></td>
                            <td><Input v-model="dataModel.PeopleNum_zcqt"></Input></td>
                        </tr>
                    </table>
                </Tab-pane>
            </Tabs>
            <div slot="footer">
                <div style="text-align:right;padding-top:10px">
                        <Button type="primary" @click="save()">保存</Button>
                        <Button type="ghost" @click="cancel()" style="margin-left: 5px">取消</Button>
                    </div>
                <Alert style="margin-top:5px;text-align:left" banner type="error">
                    填报说明: 全省范围内从乡（镇）推广站起，逐级全面统计，由州（市）汇总后上报
                    <span slot="desc"></span>
                </Alert>
            </div>
        </Modal>
        <!--**********************************数据查看框***************************************************************-->
        <Modal v-model="ViewType" :mask-closable="false" width="800">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">蔬菜经营实体情况填报表</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
             <div class="seeTable">
                <table class="reportTable">
                    <tr>
                        <td width="25%">种类</td>
                        <td width="45%" colspan="2">详细类别</td>
                        <td width="15%">单位</td>
                        <td width="15%">数量</td>
                    </tr>
                    <tr>
                        <td  rowspan="4">蔬菜技术服务机构</td>
                        <td colspan="2">机构总数</td>
                        <td>个</td>
                        <td>{{dataModel.InstituNum}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="3">按地区划分</td>
                        <td>州(市)级机构数</td>
                        <td>个</td>
                        <td>{{dataModel.InstituNum_City}}</td>
                    </tr>
                    <tr>
                        <td>县(市)级机构数</td>
                        <td>个</td>
                        <td>{{dataModel.InstituNum_Area}}</td>
                    </tr>
                    <tr>
                        <td>县(乡)级机构数</td>
                        <td>个</td>
                        <td>{{dataModel.InstituNum_town}}</td>
                    </tr>
                    <tr>
                        <td rowspan="19">蔬菜专业技术人员</td>
                        <td colspan="2">总人数</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="2">按地区划分</td>
                        <td>州市级人数</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_City}}</td>
                    </tr>
                    <tr>
                        <td>县乡级人数</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_Area}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="2">按性别分</td>
                        <td>男</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_man}}</td>
                    </tr>
                    <tr>
                        <td>女</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_woman}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="4">按年龄分</td>
                        <td>30岁以下(含30岁)</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_age1}}</td>
                    </tr>
                    <tr>
                        <td>30-40岁(含40岁)</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_age2}}</td>
                    </tr>
                    <tr>
                        <td>40-50岁(含50岁)</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_age3}}</td>
                    </tr>
                    <tr>
                        <td>50岁以上</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_age4}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="5">按学历层次分</td>
                        <td>硕士及以上</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_xlss}}</td>
                    </tr>
                    <tr>
                        <td>本科</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_xlbk}}</td>
                    </tr>
                    <tr>
                        <td>大专</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_xldz}}</td>
                    </tr>
                    <tr>
                        <td>中专（技校）</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_xlzz}}</td>
                    </tr>
                    <tr>
                        <td>其他</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_xlqt}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="5">职称情况</td>
                        <td>正高级职称</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_zczgj}}</td>
                    </tr>
                    <tr>
                        <td>副高级职称</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_zcfgj}}</td>
                    </tr>
                    <tr>
                        <td>中级职称</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_zczj}}</td>
                    </tr>
                    <tr>
                        <td>初级职称</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_zccj}}</td>
                    </tr>
                    <tr>
                        <td>其他</td>
                        <td>人</td>
                        <td>{{dataModel.PeopleNum_zcqt}}</td>
                    </tr>
                </table>
            </div>
            <div slot="footer">
                <Alert style="margin-top:5px;text-align:left" banner type="error">
                    填报说明: 全省范围内从乡（镇）推广站起，逐级全面统计，由州（市）汇总后上报
                    <span slot="desc"></span>
                </Alert>
            </div>
        </Modal>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                self: this,
                TableCodeList: this.GetGroupDict("ReportTableName"), //表名称
                CreateYearList: this.GetGroupDict("ReportYear"), //周期
                CycleList: this.GetGroupDict("ReportCycle"), //
                TabTitleList: [], //tab选项卡列表
                selectTabName: '',
                showType: false, //编辑框弹出状态
                ViewType: false,
                TableHeader: [{
                        title: '报表名称',
                        key: 'ReportCodeName',
                        ellipsis: true
                    },
                    {
                        title: '归属地区',
                        key: 'AreaCodeName',
                        width: 200
                    },
                    {
                        title: '填报年度',
                        key: 'FillInYearName',
                        width: 110
                    },
                    {
                        title: '填报周期',
                        key: 'TimesTypeName',
                        width: 110
                    },
                    {
                        title: '周期详情',
                        key: 'TimesCycleName',
                        width: 110
                    },
                    {
                        title: '审核意见',
                        key: 'Opinion',
                        width: 150,
                        ellipsis: true
                    },
                    {
                        title: "报表状态",
                        key: "StatusName",
                        width: 110,
                        render:(h,params)=>{
                            switch (params.row.Status * 1) {
                                case 0: //审核未通过
                                    return h('span',{class:{Error:true}},params.row.StatusName);
                                case 1: //未填报
                                    return h('span',{class:{NoReport:true}},params.row.StatusName);
                                case 2: //已填报
                                    return h('span',{class:{AlreadyReport:true}},params.row.StatusName);
                                case 3: //已上报
                                    return h('span',{class:{UpReport:true}},params.row.StatusName);                                    
                                case 4: //审核通过
                                    return h('span',{class:{Success:true}},params.row.StatusName);                                    
                                case 5: //锁定
                                    return h('span',{class:{error:true}},params.row.StatusName);                                    
                                default:
                                    return h('span',{class:{Default:true}},params.row.StatusName);                                    
                            }
                        }
                    },
                    {
                        title: '添加时间',
                        key: 'StrAddTime',
                        width: 180
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 240,
                        align: 'center',
                        render:(h,params)=>{
                            switch (params.row.Status * 1) {
                                case 0: //审核未通过
                                        return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);
                                case 1: //未填报
                                     return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);
                                case 2: //已填报
                                    return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);
                                case 3: //已上报
                                     return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true},attrs:{disabled:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true},attrs:{disabled:true}, props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);                                   
                                case 4: //审核通过
                                    return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);                                 
                                case 5: //锁定
                                     return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);                               
                                default:
                                     return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);                                 
                            }
                        }
                    }
                ],
                //查询模型：根据需求删除不不要查询条件
                //蔬菜生产情况表代码
                searchModel: {
                    Id: '',
                    ReportCode: 'VegTecPromotion',
                    FillInYear: '',
                    TimesType: '',
                    AreaCode: '',
                    PageNumber: 1,
                    PageSize: 20,
                    Status: '',
                    Opinion: ''
                },
                dataModel:{
                    Id: 0,
                    ReportId:'', 
                    InstituNum:'', 
                    InstituNum_City:'', 
                    InstituNum_Area:'', 
                    InstituNum_town:'', 
                    PeopleNum:'', 
                    PeopleNum_City:'',
                    PeopleNum_Area:'',
                    PeopleNum_man:'', 
                    PeopleNum_woman:'', 
                    PeopleNum_age1:'', 
                    PeopleNum_age2:'', 
                    PeopleNum_age3:'', 
                    PeopleNum_age4:'', 
                    PeopleNum_xlss:'', 
                    PeopleNum_xlbk:'', 
                    PeopleNum_xldz:'', 
                    PeopleNum_xlzz:'', 
                    PeopleNum_xlqt:'', 
                    PeopleNum_zczgj:'', 
                    PeopleNum_zcfgj:'', 
                    PeopleNum_zczj:'', 
                    PeopleNum_zccj:'', 
                    PeopleNum_zcqt:''
                },
                pageSizeOpts: [20, 40, 50], //默认分页最大设置
                datas: {}, //table数据对象
                dataIds: [],
                ctx: this, //table数据上下文
                clientHeight: window.innerHeight - 270, //表格默认高度
            }
        },
        mounted() {
            //table高度计算方法
            const that = this;
            window.onresize = () => {
                return (() => {
                    that.clientHeight = window.innerHeight - 220;
                })()
            };
        },
        methods: {
            checkInstitu(){//机构数据校验
                var InstituNum=this.dataModel.InstituNum; 
                var InstituNum_City=this.dataModel.InstituNum_City;
                var InstituNum_Area=this.dataModel.InstituNum_Area; 
                var InstituNum_town=this.dataModel.InstituNum_town; 
                if(InstituNum==null)
                {
                    if(InstituNum_City!=null&&InstituNum_Area!=null||InstituNum_town!=null)
                    {
                        this.$Modal.error({
                            title: "提示信息",
                            content: "蔬菜机构总数为空,子项不为空!!!"
                        });
                        return false;
                    }else{//机构数据全部为空(表示没有)
                        return true;
                    }
                }
                else{
                    InstituNum=InstituNum==null?0:Number(InstituNum);
                    InstituNum_City=InstituNum_City==null?0:Number(InstituNum_City);
                    InstituNum_Area=InstituNum_Area==null?0:Number(InstituNum_Area);
                    InstituNum_town=InstituNum_town==null?0:Number(InstituNum_town);
                    if(InstituNum!=InstituNum_City+InstituNum_Area+InstituNum_town)
                    {
                        this.$Modal.error({
                            title: "提示信息",
                            content: "蔬菜机构总数=州市机构数+区县机构数+乡镇机构数!!!"
                        });
                        return false;
                    }
                    else{
                        return true;
                    }
                }
            },
            checkPeople(){//蔬菜专业技术人员
                var PeopleNum=this.dataModel.PeopleNum;
                var PeopleNum_City=this.dataModel.PeopleNum_City;
                var PeopleNum_Area=this.dataModel.PeopleNum_Area;
                var PeopleNum_man=this.dataModel.PeopleNum_man;
                var PeopleNum_woman=this.dataModel.PeopleNum_woman;
                var PeopleNum_age1=this.dataModel.PeopleNum_age1;
                var PeopleNum_age2=this.dataModel.PeopleNum_age2; 
                var PeopleNum_age3=this.dataModel.PeopleNum_age3; 
                var PeopleNum_age4=this.dataModel.PeopleNum_age4;
                var PeopleNum_xlss=this.dataModel.PeopleNum_xlss; 
                var PeopleNum_xlbk=this.dataModel.PeopleNum_xlbk; 
                var PeopleNum_xldz=this.dataModel.PeopleNum_xldz; 
                var PeopleNum_xlzz=this.dataModel.PeopleNum_xlzz; 
                var PeopleNum_xlqt=this.dataModel.PeopleNum_xlqt;
                var PeopleNum_zczgj=this.dataModel.PeopleNum_zczgj; 
                var PeopleNum_zcfgj=this.dataModel.PeopleNum_zcfgj; 
                var PeopleNum_zczj=this.dataModel.PeopleNum_zczj;
                var PeopleNum_zccj=this.dataModel.PeopleNum_zccj;
                var PeopleNum_zcqt=this.dataModel.PeopleNum_zcqt;
                if(PeopleNum==null||PeopleNum=="")
                {
                    if(PeopleNum_City!=null||PeopleNum_Area!=null||PeopleNum_man!=null||PeopleNum_woman!=null||PeopleNum_age1!=null||PeopleNum_age2!=null||PeopleNum_age3!=null||PeopleNum_age4!=null||PeopleNum_xlss!=null ||PeopleNum_xlbk!=null||PeopleNum_xldz!=null||PeopleNum_xlzz!=null||PeopleNum_xlqt!=null||PeopleNum_zczgj!=null||PeopleNum_zcfgj!=null||PeopleNum_zczj!=null||PeopleNum_zccj!=null||PeopleNum_zcqt!=null)
                    {
                        this.$Modal.error({
                            title: "提示信息",
                            content: "总人数为空,其他子项不为空!!!"
                        }); 
                        return false;
                    }
                    else{
                        return true
                    }
                }
                 else{
                        PeopleNum=PeopleNum==null?0:Number(PeopleNum);
                        PeopleNum_City=PeopleNum_City==null?0:Number(PeopleNum_City);
                        PeopleNum_Area=PeopleNum_Area==null?0:Number(PeopleNum_Area);
                        PeopleNum_man=PeopleNum_man==null?0:Number(PeopleNum_man);
                        PeopleNum_woman=PeopleNum_woman==null?0:Number(PeopleNum_woman);
                        PeopleNum_age1=PeopleNum_age1==null?0:Number(PeopleNum_age1);
                        PeopleNum_age2=PeopleNum_age2==null?0:Number(PeopleNum_age2); 
                        PeopleNum_age3=PeopleNum_age3==null?0:Number(PeopleNum_age3);
                        PeopleNum_age4=PeopleNum_age4==null?0:Number(PeopleNum_age4);
                        PeopleNum_xlss=PeopleNum_xlss==null?0:Number(PeopleNum_xlss);
                        PeopleNum_xlbk=PeopleNum_xlbk==null?0:Number(PeopleNum_xlbk); 
                        PeopleNum_xldz=PeopleNum_xldz==null?0:Number(PeopleNum_xldz); 
                        PeopleNum_xlzz=PeopleNum_xlzz==null?0:Number(PeopleNum_xlzz); 
                        PeopleNum_xlqt=PeopleNum_xlqt==null?0:Number(PeopleNum_xlqt);
                        PeopleNum_zczgj=PeopleNum_zczgj==null?0:Number(PeopleNum_zczgj);
                        PeopleNum_zcfgj=PeopleNum_zcfgj==null?0:Number(PeopleNum_zcfgj);
                        PeopleNum_zczj=PeopleNum_zczj==null?0:Number(PeopleNum_zczj);
                        PeopleNum_zccj=PeopleNum_zccj==null?0:Number(PeopleNum_zccj);
                        PeopleNum_zcqt=PeopleNum_zcqt==null?0:Number(PeopleNum_zcqt);
                        if(PeopleNum<(PeopleNum_City+PeopleNum_Area))
                        {
                            this.$Modal.error({
                            title: "提示信息",
                            content: "总人数>州市级人数+县乡级人数!!!"
                        }); 
                            return false;
                        }
                    else  if(PeopleNum!=(PeopleNum_man+PeopleNum_woman))
                        {
                        this.$Modal.error({
                            title: "提示信息",
                            content: "总人数=男人数+女人数!!!"
                        }); 
                            return false;
                        }
                        else if(PeopleNum!=(PeopleNum_age1+PeopleNum_age2+PeopleNum_age3+PeopleNum_age4))
                        {
                        this.$Modal.error({
                            title: "提示信息",
                            content: "总人数=30岁以下(含30岁)+30-40岁(含40岁)+40-50岁(含50岁)+50岁以上!!!"
                        }); 
                            return false;
                        }
                        else if(PeopleNum!=(PeopleNum_xlss+PeopleNum_xlbk+PeopleNum_xldz+PeopleNum_xlzz+PeopleNum_xlqt))
                        {
                            this.$Modal.error({
                            title: "提示信息",
                            content: "总人数=硕士及以上+本科+大专+中专（技校）+其他!!!"
                        }); 
                            return false;
                        }
                        else if(PeopleNum!=(PeopleNum_zczgj+PeopleNum_zcfgj+PeopleNum_zczj+PeopleNum_zccj+PeopleNum_zcqt))
                        {
                            this.$Modal.error({
                            title: "提示信息",
                            content: "总人数=正高级职称+副高级职称+中级职称+初级职称+其他!!!"
                        }); 
                            return false;
                        }
                        else{
                        return  true;
                        }
                }
            },
            checkData(){
                if(this.checkInstitu()&&this.checkPeople()){
                    return true;
                }else{
                    return false;
                }
            },
            See: function(id, reportCode) { //数据查看
                var self = this;
                self.$http.get("Report", {
                    params: {
                        id: id,
                        reportCode: reportCode
                    }
                }).then( //获取数据编辑项的值
                    function(res) {
                        switch (res.data.list.status) {
                            case 1:
                                self.dataModel=res.data.list.model;
                                self.ViewType = true;
                                break;
                            case 0:
                                self.$Modal.error({
                                    title: "提示信息",
                                    content: "数据加载失败!!!"
                                });
                                break;
                            case -1:
                                self.$Modal.error({
                                    title: "提示信息",
                                    content: "数据加载失败!!!"
                                });
                                break;
                        }
                    }
                );
            },
            getTab(name) {
                //console.log(name);
                this.selectTabName = name;
            },
            //查看报表
            showInfo(id, reportCode) {},
            //获取当前页码
            getPageNumber(pageIndex) {
                this.searchModel.PageNumber = pageIndex;
                this.getPageData();
            },
            //获取当前分页大小
            getPageSize(pageSize) {
                this.searchModel.PageSize = pageSize;
                this.getPageData();
            },
            //获取this.datas: {},//table数据对象
            getPageData() {
                var self = this;
                var user = this.GetlocaStorage("VegUserInfo");
                this.searchModel.AreaCode = user.AreaCode;
                self.$http.post('Report/PostPageList', this.searchModel).then(function(res) {
                    if (res.data.status === 1) {
                        self.datas = res.data;
                    } else {
                        self.$Modal.error({
                            title: '提示信息',
                            content: res.data.message
                        });
                    }
                });
            },
            //编辑获取对象传入id
            Edit: function(id, reportCode) {
                var self = this;
                this.$http.get("Report", {
                    params: {
                        id: id,
                        reportCode: reportCode
                    }
                }).then( //获取数据编辑项的值
                    function(res) {
                        switch (res.data.list.status) {
                            case 1:
                                self.dataModel=res.data.list.model;
                                self.modalShow();
                                break;
                            case 0:
                                self.$Modal.error({
                                    title: "提示信息",
                                    content: "编辑数据加载失败!!!"
                                });
                                break;
                            case -1:
                                self.$Modal.error({
                                    title: "提示信息",
                                    content: "编辑数据加载失败!!!"
                                });
                                break;
                        }
                    }
                );
            },
            
            //删除对象
            Delete(id) {
                var self = this;
                self.$Modal.confirm({
                    title: '提示信息',
                    content: '<p>数据删除后不可恢复，确定要删除？</p>',
                    onOk: () => {
                        this.$http.delete("GenerateLog", {
                            params: {
                                id: id
                            }
                        }).then(
                            function(res) {
                                if (res.data.status == 1) {
                                    self.$Notice.success({
                                        title: '删除成功！',
                                        desc: false
                                    });
                                    self.getPageData();
                                } else {
                                    self.$Modal.error({
                                        title: "提示信息",
                                        content: "数据删除失败!!!"
                                    });
                                }
                            }
                        );
                    }
                });
            },
            //保存方法
            save() {
                var self = this;
                if(self.checkData())
                {
                    this.$http.put('VegTecPromotion', self.dataModel).then(
                        function(res) {
                            if (res.data.status == 1) {
                                self.getPageData(); //读取分页数据
                                self.$Notice.success({
                                    title: '保存成功！',
                                    desc: false
                                });
                            } else {
                                self.$Modal.warning({
                                    title: "提示信息",
                                    content: "更新失败,请与管理员联系!"
                                });
                            }
                    });
                }
            },
            //数据上报
            DataUp: function(ReportId, Status, Msg) {
                var self = this;
                self.searchModel.Id = ReportId;
                self.searchModel.Status = Status;
                self.searchModel.Opinion = Msg;
                self.$Modal.confirm({
                    title: '提示信息',
                    content: '<p>数据上报后，不能再更改，是否继续上报？</p>',
                    onOk: () => {
                        self.$http.post('Report/PostUpStatus', self.searchModel).then(function(res) {
                            if (res.data.status === 1) {
                                self.$Notice.success({
                                    title: '数据上报成功',
                                    desc: false
                                });
                                self.searchModel.Status = '';
                                self.getPageData(); //读取分页数据
                            } else {
                                self.$Notice.success({
                                    title: '数据上报失败',
                                    desc: res.data.messages
                                });
                            }
                        });
                    },
                    onCancel: () => {}
                });
            },
            //编辑框打开
            modalShow() {
                this.showType = true;
            },
            //编辑框关闭
            modalHide() {
                this.showType = false;
            },
            //取消方法
            cancel() {
                this.showType = false; //关闭modal
                this.TabTitleList = [];
            },
            //重置model
            restModel(modelname) {
                this.$refs[modelname].resetFields(); //重置model
            }
        },
        //创建Vue页面方法
        created: function() {
            //创业Vue前调用获取this.datas: {},//table数据对象
            this.getPageData();
        },
        watch: {
            //需要监听的在此处新增监听对象
        }
    }
</script>
